const webpack = require('webpack');
const { merge } = require('webpack-merge'); // 使用merge方法合并配置
const common = require('./webpack.common'); // 导入公共配置
const path = require('path');

module.exports = merge(common, {
    mode: 'development', // 开发依赖
    devtool: 'source-map',
    devServer: {
        host: 'localhost',
        port: '2020',
        open: true, // 启动服务时，自动打开浏览器
        hot: true, // 开启热更新功能
        contentBase: [
            path.join(__dirname, 'public'),
            path.join(__dirname, 'src/assets'),
        ],
    },
    plugins: [new webpack.HotModuleReplacementPlugin()],
});
